<template>
  <div>
    {{title}}:
    <el-select
      v-model="selectValue"
      filterable
      :placeholder="'选择'+title"
      style="width:60%"
      @change="changeValue"
    >
    <el-option
      v-for="item in selectArray"
      :key="item"
      :label="item"
      :value="item"
    />
  </el-select>
  <span :style="{'color':[isRequire === '必选'?'red':'green'],'margin-left':'5px'}">{{isRequire}}</span>
  </div>
</template>

<script>
  export default {
    name:'myObject',
    props:['title','inputData','isRequire','id','selectArray'],
    data(){
      return {
        selectValue:this.inputData
      }
    },
    methods:{
      changeValue(){
        //去修改父组件的值
        this.$emit('editLeisItemsData',{value:this.selectValue,id:this.id})
      }
    }
  }
</script>

<style lang="scss" scoped>
div{
  width: 100%;
  display: inline-block;
}
</style>